﻿@model IEnumerable<EL_Tavolo>

@using WebApp.Extensions
@using Telerik.Web.Mvc.UI
@using WebApp.ViewModels

@{
    Layout = "_Layout.cshtml";
}

@{
    ViewBag.Title = "Tavolo: " + ViewBag.SET_Ordine.Tavoli;
}

<div class="label">
    <span>Sala: @ViewBag.ENT_Sala.Nome</span>
</div>

@(Html.Telerik().Menu()
        .Name("Menu")
        .BindTo(SelectListHandler.ENT_Sala(), 
            mappings => mappings.For<SelectListItem>(
                binding => binding.ItemDataBound((item, sala) =>
            {
                item.Text = sala.Text;
                item.Url = Url.Action("ORD_TAV", "Tavoli", new { f0 = ViewBag.SET_Ordine.Guid, f1 = sala.Value });
            }))))

<div class="dashboard">
    @foreach (var item in Model)
    {
        if (item.Selezionato)
        {
        <div class="j-panel j-table j-blue" 
            onclick="document.location.href='@Url.Action("ORD_TAV", "Tavoli", new { f0 = ViewBag.SET_Ordine.Guid, f1 = ViewBag.ENT_Sala.Guid, f2 = "DEL", f3 = item.Tavolo })'">
            <div><b>@item.Nome</b></div>
            <div>(Selezionato)</div>
        </div>
        }
        else
        {
        <div class="j-panel j-table j-green" 
            onclick="document.location.href='@Url.Action("ORD_TAV", "Tavoli", new { f0 = ViewBag.SET_Ordine.Guid, f1 = ViewBag.ENT_Sala.Guid, f2 = "SET", f3 = item.Tavolo })'">
            <div><b>@item.Nome</b></div>
            <div>(Non selezionato)</div>
        </div>
        }
    }
</div>

@section submenu
{
    <tr>
        <td class="submenu_2" onclick="document.location.href='@Url.Action("ORD_CMD_SEL", "Tavoli", new { f0 = ViewBag.SET_Ordine.Guid })'">Aggiungi portata
        </td>
    </tr>
    <tr>
        <td class="submenu_2" onclick="document.location.href='@Url.Action("ORD_CMD", "Tavoli", new { f0 = ViewBag.SET_Ordine.Guid })'">Comande
        </td>
    </tr>
    <tr>
        <td class="submenu_2" onclick="document.location.href='@Url.Action("ORD_TAV", "Tavoli", new { f0 = ViewBag.SET_Ordine.Guid })'">Tavoli
        </td>
    </tr>
    <tr>
        <td class="submenu_2" onclick="document.location.href='@Url.Action("ORD_PAG", "Tavoli", new { f0 = ViewBag.SET_Ordine.Guid })'">Paga
        </td>
    </tr>
}
